<include file="Public:header" />
<div id="zoneHeader">
    <h2>站长结算管理</h2>
    <ul>
        <li><a href="javascript:;" class="btn" id="mPayBtn">支付</a></li>
        <li><a href="javascript:exportTo('?m=PayLog&a=export')" class="btn" id="mPayBtn">导出以下数据</a></li>
    </ul>
</div><!--/#zoneHeader-->
<div id="zoneBody">
    <div id="zoneBodySearch">
        <form id="formSearch" action="?m={$Think.const.MODULE_NAME}">
            <input type="hidden" name="sort" />
            <input type="hidden" name="sortdir" />
            <ul>
                <li><b>
                    <select name="search_item_1">
                        <option value="uid">站长编号</option>
                        <option value="user_name">站长名称</option>
                    </select> ：</b>
                    <input type="text" name="search_item_val_1" class="fW100p" />
                </li>
                <li><b>结算日期：</b><input type="text" name="p_l_add_date" class="fW80p" /></li>
                <li>
                    <select name="p_l_clearing">
                        <option value="">结算周期</option>
                        <volist name=":C('CLEARING_TYPE')" id="vo">
                        <option value="{$key|strtolower}">{$vo}</option>
                        </volist>
                    </select>
                </li>
                <li>
                    <select name="p_l_status">
                        <option value="">支付状态</option>
                        <volist name=":C('PAY_LOG_STATUS')" id="vo">
                        <option value="{$key}">{$vo}</option>
                        </volist>
                    </select>
                </li>
                <li>
                    <select name="siter_status">
                        <option value="">站长状态</option>
                        <volist name=":C('USER_STATUS')" id="vo">
                        <option value="{$key}">{$vo}</option>
                        </volist>
                    </select>
                </li>
                <li>
                    <select name="bank">
                        <option value="">银行名称</option>
                        <volist name=":C('BANK')" id="vo">
                        <option value="{$key|strtolower}">{$vo}</option>
                        </volist>
                    </select>
                </li>
                <li><button type="button" id="as" class="btnSearch">查询</button></li>
                <li><button type="button" class="btnResetForm">清空表单</button></li>
            </ul>
        </form>
    </div><!--/#zoneBodySearch-->
    <div id="zoneBodyContent">
        <form id="payLogListForm">
        <table class="table2">
            <thead>
                <tr>
                    <th width="10"><input type="checkbox" t="checkboxChoiceMasterDom" item="checkboxChoiceItemDom" /></th>
                    <th><a href="javascript:;" sort="p_l_add_date">结算日期</a></th>
                    <th>结算周期</th>
                    <th>支付状态</th>
                    <th><a href="javascript:;" sort="uid">站长编号</a></th>
                    <th><a href="javascript:;" sort="user_name">站长名称</a></th>
                    <th><a href="javascript:;" sort="status">站长状态</a></th>
                    <th><a href="javascript:;" sort="p_l_money">广告金额</a></th>
                    <th>税</th>
                    <th>手续费</th>
                    <th><a href="javascript:;" sort="p_l_real_money">应付金额</a></th>
                    <th>实付比例</th>
                    <th><a href="javascript:;" sort="p_l_pay_money">实付金额</a></th>
                    <th>备注</th>
                    <th>操作</th>
                </tr>
            </thead>
            <volist name="page.record" id="vo">
            <tr>
                <td><input type="checkbox" name="id[]" value="{$vo.p_l_id}" t="checkboxChoiceItemDom" /> </td>
                <td>{$vo.p_l_add_date}</td>
                <td>{$vo.p_l_clearing|getClearingCn}</td>
                <td>{$vo.p_l_status|getPayLogStatusCn}</td>
                <td><a href="?m=PayLog&sort=&sortdir=&search_item_1=uid&search_item_val_1={$vo.uid}&p_l_add_date=&p_l_clearing=&p_l_status={$Think.get.p_l_status}&siter_status=&bank=&uid={$vo.uid}" title="查看此站长结算汇总">#{$vo.uid}</a></td>
                <td><a href="?m=PayLog&sort=&sortdir=&search_item_1=user_name&search_item_val_1={$vo.user_name}&p_l_add_date=&p_l_clearing=&p_l_status={$Think.get.p_l_status}&siter_status=&bank=&user_name={$vo.user_name}" title="查看此站长结算汇总">{$vo.user_name}</a></td>
                <td>{$vo.status|getUserStatusCn}</td>
                <td>{$vo.p_l_money|default='0'}</td>
                <td>{$vo.p_l_tax}</td>
                <td>{$vo.p_l_charges}</td>
                <td>{$vo.p_l_real_money}</td>
                <td>
                    <if condition="$vo.p_l_status EQ 0">
                    <input type="text" name="r[{$vo.p_l_id}][scale]" t="scale" status="{$vo.p_l_status}" money="{$vo.p_l_real_money}" value="{$vo.p_l_scale}" class="fW30p" />
                    <else />
                    {$vo.p_l_scale}
                    </if>
                    %</td>
                <td>
                    <if condition="$vo.p_l_status EQ 0">
                    <input type="text" name="r[{$vo.p_l_id}][money]" t="payMoney" value="{:payMoneyFormat($vo['p_l_pay_money'], 1)}" class="fW80p" /> 
                    <else />
                    {$vo.p_l_pay_money}
                    </if>
                </td>
                <td>
                    <if condition="$vo.p_l_status EQ 0">
                    <textarea name="r[{$vo.p_l_id}][comment]" t="comment" style="width:95%;height:50px;">{$vo.p_l_comment}</textarea>
                    <else />
                    {$vo.p_l_comment}
                    </if>
                </td>
                <td class="tAction">
                    <a href="javascript:;" action='save' style="display:none">保存</a>
                    <a href="javascript:;" action="pay" <eq name="vo.p_l_status" value="1">class="hide"</eq> >支付</a>
                    <if condition="date('Y-m-d', strtotime($vo['p_l_pay_time'])) EQ date('Y-m-d')">
                    <a href="javascript:;" action="unPay" <eq name="vo.p_l_status" value="0">class="hide"</eq> >撤销支付</a>
                    </if>
                </td>
            </tr>
            <tr>
                <td colspan="15">
                    <ul class="payLogOtherInfo">
                        <li><b>收款人：</b><span>{$vo.accountname}</span></li>
                        <li><b>银行：</b><span>{$vo.bank|getBankNameCn}</span></li>
                        <li><b>开户行名称：</b><span>{$vo.bankname}</span></li>
                        <li><b>银行帐号：</b><span>{$vo.bankacc}</span></li>
                    </ul>
                    <ul class="payLogOtherInfo">
                        <li><b>支付时间：</b><span>{$vo.p_l_pay_time}</span></li>
                        <li><b>支付操作员：</b><span>{$vo.p_l_operator}</span></li>
                    </ul>
                </td>
            </tr>
            </volist>
        </table>
        </form>

        <if condition="!empty($_GET['uid']) OR !empty($_GET['user_name'])">
        <p style="text-align:center; font-size:20px; margin-top:20px; ">
            应付金额：<input type="text" value="{:payMoneyFormat($yfMoney, 1)}" readonly="true" style="font-size:20px; border:0; width:200px;">
        </p>
        </if>
    </div><!--/#zoneBodyContent-->
</div><!--/#zoneBody-->
<script>
$(function(){
    $('#formSearch').find('input[name=p_l_add_date]').datebox();
    PayLog.index.init();
})
</script>
<div id="zoneFooter">
    <p>应付:{$yfMoney} / 实付:<input id="sf_money_zone" value="{:payMoneyFormat($yfMoney, 1)}" style="border:0; padding:0 5px; display:inline-block; width:80px;" readonly="true"> ｜ 共{$page['total']}条 / 每页{$page['size']}条 / 共{$page['totalPage']}页</p>
        <div class="pager">{$page['link']}</div>
</div><!--/#zoneFooter-->
<include file="Public:footer" />
